/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

#include <stdlib.h>
#include <flgrCoreMalloc.h>
#include <flgrCoreDispatch.h>
#include "flgrDataToolsFifo.h"


/*!
 * \defgroup group_fulguro_datatools_dynamic_fifo Dynamic Size Fifo
 * \brief Basic tools for manipulating Dynamic Size Fifo
 * \ingroup group_fulguro_datatools
 * @{
 */

void flgr_fifo_init(FLGR_Fifo *fifo) {
  fifo->input = NULL;
  fifo->output = NULL;
  fifo->label = NULL;
  fifo->size = 0;
}

FLGR_Fifo *flgr_fifo_create(void) {
  FLGR_Fifo *fifo = (FLGR_Fifo *) flgr_malloc(sizeof(FLGR_Fifo));

  flgr_fifo_init(fifo);

  return fifo;
}

int flgr_fifo_get_size(FLGR_Fifo *fifo) {
  return fifo->size;
}

void flgr_fifo_flush(FLGR_Fifo *fifo) {
  while(flgr_fifo_get_size(fifo)!=0) {
    flgr_fifo_del_current(fifo);
  }
}

void flgr_fifo_destroy(FLGR_Fifo *fifo) {
  flgr_fifo_flush(fifo);
  flgr_free(fifo);
}





//! @}
